<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 500px;
            height: 500px;
            background-color: rgb(96, 98, 98);
            
            /* 1.在父元素中设置flex布局 */
            display: flex;
            
            /* 2.默认设置主轴方向为x轴 */
            flex-direction: row;

            /* 3.设置主轴的元素排列 先贴边再均分 */
            justify-content: space-between;

            /* 4.flex布局元素换行，如果装不下会缩小子元素的宽度放在父元素中 */
            /* 默认所有元素在一排 */
            flex-wrap: nowrap;
            /* 多余元素排列在下一行 */
            /* flex-wrap: wrap; */
        }
        div span{
            border: 1px solid #ffffff;
            width: 100px;
            height: 100px;
            background-color: rgb(109, 140, 140);
        }
    </style>
</head>
<body>
    <div>
        <span>1</span>
        <span>2</span>
        <span>3</span>
        <span>4</span>
        <span>5</span>
        <span>6</span>
        <span>7</span>
        <span>8</span>
    </div>
</body>
</html>